]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
js: Stop wrapping ease() in promise
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 2 Dec 2025 14:32:16 +0000 (15:32 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 18 Dec 2025 16:33:25 +0000 (17:33 +0100)
We can now use the async variants instead.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4007>

js/ui/layout.js
js/ui/messageList.js
js/ui/overviewControls.js

index 06afaa2aa70397028a34b0f73b6d341dde024048..d415e595de48f1de4393926d5b7983a8eee57cb0 100644 (file)
@@ -16,6 +16,8 @@ import * as Main from './main.js';
 import * as Params from '../misc/params.js';
 import * as Ripples from './ripples.js';
 
+import {logErrorUnlessCancelled} from '../misc/errorUtils.js';
+
 export const STARTUP_ANIMATION_TIME = 500;
 export const BACKGROUND_FADE_ANIMATION_TIME = 1000;
 
@@ -775,30 +777,24 @@ export const LayoutManager = GObject.registerClass({
     }
 
     async _startupAnimationGreeter() {
-        await new Promise(resolve => {
-            this.panelBox.ease({
-                translation_y: 0,
-                duration: STARTUP_ANIMATION_TIME,
-                mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onStopped: () => resolve(),
-            });
-        });
+        await this.panelBox.easeAsync({
+            translation_y: 0,
+            duration: STARTUP_ANIMATION_TIME,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        }).catch(logErrorUnlessCancelled);
     }
 
     async _startupAnimationSession() {
         if (Main.sessionMode.hasOverview) {
             await Main.overview.runStartupAnimation();
         } else {
-            await new Promise(resolve => {
-                this.uiGroup.ease({
-                    scale_x: 1,
-                    scale_y: 1,
-                    opacity: 255,
-                    duration: STARTUP_ANIMATION_TIME,
-                    mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                    onStopped: () => resolve(),
-                });
-            });
+            await this.uiGroup.easeAsync({
+                scale_x: 1,
+                scale_y: 1,
+                opacity: 255,
+                duration: STARTUP_ANIMATION_TIME,
+                mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            }).catch(logErrorUnlessCancelled);
         }
     }
 
index c745acbc24528f09aacdd7df134e2422b57964ef..170ba5e8a40f412c79e2bf585fe065eeadbb62cc 100644 (file)
@@ -16,6 +16,7 @@ import * as Mpris from './mpris.js';
 
 import * as Util from '../misc/util.js';
 import {formatTimeSpan} from '../misc/dateUtils.js';
+import {logErrorUnlessCancelled} from '../misc/errorUtils.js';
 
 const MAX_NOTIFICATION_BUTTONS = 3;
 export const MESSAGE_ANIMATION_TIME = 100;
@@ -979,13 +980,10 @@ export const NotificationMessageGroup = GObject.registerClass({
         this.notify('expanded');
         this._cover.hide();
 
-        await new Promise((resolve, _) => {
-            this.ease_property('@layout.expansion', 1, {
-                progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                duration: GROUP_EXPENSION_TIME,
-                onComplete: () => resolve(),
-            });
-        });
+        await this.ease_property_async('@layout.expansion', 1, {
+            progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            duration: GROUP_EXPENSION_TIME,
+        }).catch(logErrorUnlessCancelled);
     }
 
     async collapse() {
@@ -1003,13 +1001,10 @@ export const NotificationMessageGroup = GObject.registerClass({
         this._cover.show();
         this._updateStackedMessagesFade();
 
-        await new Promise((resolve, _) => {
-            this.ease_property('@layout.expansion', 0, {
-                progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                duration: GROUP_EXPENSION_TIME,
-                onComplete: () => resolve(),
-            });
-        });
+        await this.ease_property_async_async('@layout.expansion', 0, {
+            progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            duration: GROUP_EXPENSION_TIME,
+        }).catch(logErrorUnlessCancelled);
 
         this._headerBox.hide();
     }
index 478318bd503eefc40a6b90d4d1a10a1e7b09913b..135168194ca9eaac15601c92f75b6d14ab0553df 100644 (file)
@@ -806,13 +806,11 @@ class ControlsManager extends St.Widget {
         const startupPromises = [];
 
         this._stateAdjustment.value = ControlsState.HIDDEN;
-        startupPromises.push(new Promise(resolve => {
-            this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, {
+        startupPromises.push(
+            this._stateAdjustment.easeAsync(ControlsState.WINDOW_PICKER, {
                 duration: Overview.ANIMATION_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onStopped: resolve,
-            });
-        }));
+            }));
 
         this.dash.showAppsButton.checked = false;
         this._ignoreShowAppsButtonToggle = false;
@@ -824,14 +822,12 @@ class ControlsManager extends St.Widget {
         await this.layout_manager.ensureAllocation();
 
         // Opacity
-        startupPromises.push(new Promise(resolve => {
-            this.ease({
+        startupPromises.push(
+            this.easeAsync({
                 opacity: 255,
                 duration: STARTUP_ANIMATION_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onStopped: resolve,
-            });
-        }));
+            }));
 
         // Search bar falls from the ceiling
         const {primaryMonitor} = Main.layoutManager;
@@ -839,27 +835,23 @@ class ControlsManager extends St.Widget {
         const yOffset = y - primaryMonitor.y;
 
         this._searchEntryBin.translation_y = -(yOffset + this._searchEntryBin.height);
-        startupPromises.push(new Promise(resolve => {
-            this._searchEntryBin.ease({
+        startupPromises.push(
+            this._searchEntryBin.easeAsync({
                 translation_y: 0,
                 duration: STARTUP_ANIMATION_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onStopped: resolve,
-            });
-        }));
+            }));
 
         // The Dash rises from the bottom. This is the last animation to finish,
         // so resolve the promise there.
         this.dash.translation_y = this.dash.height + this.dash.margin_bottom;
-        startupPromises.push(new Promise(resolve => {
-            this.dash.ease({
+        startupPromises.push(
+            this.dash.easeAsync({
                 translation_y: 0,
                 delay: STARTUP_ANIMATION_TIME,
                 duration: STARTUP_ANIMATION_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-                onStopped: () => resolve(),
-            });
-        }));
+            }));
 
         return Promise.allSettled(startupPromises);
     }